package com.app.couponsharelife.ui.viewfactory

import android.util.SparseArray
import com.app.couponsharelife.base.LazyFragment
import com.app.couponsharelife.data.bean.OrderClassBean
import com.app.couponsharelife.ui.main.nativelife.order.fragment.ShopOrderListFragment

/**
 *Created by xct on 2019/3/13
 *Description:
 */
class ShopOrderFragFactory {
    private val mFragments = SparseArray<LazyFragment>()
    fun createFragment(position: Int,orderClassBean: OrderClassBean): LazyFragment {
        var fragment: LazyFragment? = mFragments.get(position)
        if (fragment == null) {
            when (position) {
                0 -> fragment = ShopOrderListFragment.newInstance(orderClassBean)
                1 -> fragment = ShopOrderListFragment.newInstance(orderClassBean)
                2 -> fragment = ShopOrderListFragment.newInstance(orderClassBean)
                3 -> fragment = ShopOrderListFragment.newInstance(orderClassBean)
                4 -> fragment = ShopOrderListFragment.newInstance(orderClassBean)
                5 -> fragment = ShopOrderListFragment.newInstance(orderClassBean)
                6 -> fragment = ShopOrderListFragment.newInstance(orderClassBean)
            }
            if (fragment != null) {
                mFragments.put(position, fragment)
            }
        }
        return fragment!!
    }
}